package com.it.text;

import java.util.Scanner;

public class StringText {
    public static void main(String[] args) {
        String userName = "admin";
        String password = "admin";
        Scanner sc = new Scanner(System.in);

        for (int i=1;i<=3;i++) {
            System.out.println("请输入账号:");
            String inputUserName = sc.nextLine();
            System.out.println("请输入密码:");
            String inputPassword = sc.nextLine();

            if (userName.equals(inputUserName) && password.equals(inputPassword)) {
                System.out.println("登录成功!");
                break;
            }
            else {
                if(i==3){
                    System.out.println("你的机会用完了，请明天再来！");
                }
                else {
                    System.out.println("登录失败！你还剩" + (3-i) + "次机会");
                }
            }
        }

    }




}
